package com.central.common.feign.fallback

import com.central.common.enum.AttentionTypeEnum
import com.central.common.feign.AttentionService
import com.central.common.model.RealDataResult
import feign.hystrix.FallbackFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory

/**
 * @author  fly
 * @date  2021/5/27 17:28
 * @version 1.0
 */
open class AttentionServiceFallbackFactory : FallbackFactory<AttentionService>{

    private val log: Logger = LoggerFactory.getLogger(AttentionServiceFallbackFactory::class.java)


    override fun create(p0: Throwable?): AttentionService = object : AttentionService {

        override fun getMyAttentionIdList(userId: Long, attentionTypeEnum: AttentionTypeEnum): List<String>? {

            log.error("获取$userId 的关注列表失败, 失败原因是$p0")
            return null
        }

        override fun booleanAttention(attentionId: Long, userId: Long, attentionTypeEnum: AttentionTypeEnum): RealDataResult {

            log.error("获取$userId 的关注失败, 失败原因是$p0")
            return RealDataResult()
        }

        override fun getMyFansUserId(userId: Long): List<String>? {

            log.error("获取$userId 的粉丝列表失败, 失败原因是$p0")
            return null
        }


    }
}